Skip to content

fix: run bazel-diff in cquery mode under bazelci#3839

Merged
rickeylev merged 1 commit into
bazel-contrib:mainfrom
rickeylev:fix-bazel-diff
Jun 21, 2026
Merged

fix: run bazel-diff in cquery mode under bazelci#3839
rickeylev merged 1 commit into
bazel-contrib:mainfrom
rickeylev:fix-bazel-diff

Conversation

@rickeylev

@rickeylev rickeylev commented Jun 21, 2026

Copy link
Copy Markdown
Collaborator

This PR fixes the CI breakage on main where bazel-diff ran in plain query
mode, ignoring target_compatible_with and attempting to run
platform-incompatible tests.

BazelCI has an EXP_USE_CQUERY env variable that uses cquery to identify
targets instead. Try that, which should respect TCW and filter out
targets that would be passed to bazel-diff.

@rickeylev rickeylev requested a review from aignas as a code owner June 21, 2026 03:16
@rickeylev rickeylev marked this pull request as draft June 21, 2026 03:17

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a custom java wrapper script (.bazelci/bin/java and .bazelci/bin/java.bat) to intercept bazel-diff invocations in CI, enabling the injection of cquery options and upgrading to bazel-diff v25.0.0. It also updates .bazelci/presubmit.yml to download the required jar and configure the environment path across various platforms. The review feedback highlights a critical issue in the wrapper script where executing a separate bazel query and joining all discovered test targets with + can exceed the Windows command-line length limit and introduce unnecessary overhead. The reviewer suggests passing the query expression directly to --cqueryExpression instead.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread .bazelci/bin/java Outdated
@rickeylev

Copy link
Copy Markdown
Collaborator Author

ai got pretty creative in figuring out how to call bazel-diff in cquery mode 😆

ignore this for now

We fix the CI breakage on main where bazel-diff target filtering attempted to run platform-incompatible tests.

To resolve this cleanly without wrappers or upstream patches:
1. We set EXP_USE_CQUERY=true in the environment of .reusable_config. This natively forces bazelci.py to use 'bazel cquery' instead of 'bazel query' when expanding wildcard targets, which automatically filters out all platform-incompatible tests.
2. We re-apply the visibility fix in tests/uv/lock/pyproject_toml/BUILD.bazel to ensure the cquery analysis phase succeeds without errors.
@rickeylev

Copy link
Copy Markdown
Collaborator Author

there we go, much more sane

@rickeylev rickeylev marked this pull request as ready for review June 21, 2026 03:28
@rickeylev

Copy link
Copy Markdown
Collaborator Author

since CI is broken and changes to presubmit.yml will cause bazel-diff to be skipped entirely, i'm going to force submit this.

@rickeylev rickeylev merged commit b16ce73 into bazel-contrib:main Jun 21, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant